﻿@using LiUTrading.MvcHelpers
@model LiUTrading.Models.Ad
@{
    ViewBag.Title = "Details";
}
<script type="text/javascript">
    $(document).ready(function () {
        $("#accordion").accordion();
    });
</script>
<fieldset>
    <legend>Ad</legend>
    <div id="accordion">
        <h3>
            <a href="#">Ad information</a></h3>
        <div>
            <div>
                <div class="display-label">
                    Title:</div>
                <div class="display-field">
                    @Html.DisplayFor(model => model.Title)
                </div>
                <div class="display-field">
                    <img id="adImage" src="@(new HtmlString(Model.ImageUrl))" alt="" />
                </div>
                <div class="display-label">
                    Category:
                </div>
                <div class="display-field">
                    @Html.DisplayFor(model => model.Category)
                </div>
                <div class="display-label">
                    Price:</div>
                <div class="display-field">
                    @Html.DisplayFor(model => model.Price)
                </div>
                <div class="display-label">
                    Info Text:</div>
                <div class="display-field">
                    @Html.DisplayFor(model => model.InfoText)
                </div>
                <div class="display-label">
                    Added:</div>
                <div class="display-field">
                    @Html.DisplayFor(model => model.DateTime)
                </div>
            </div>
        </div>
        @if (Request.IsAuthenticated)
        {
        <h3>
            <a href="#">Contact information</a></h3>
        <div>
            @Html.Action("ContactInformation", "Ads", new { userLiuId = Model.UserLiuId })
        </div>
        }
    </div>
    <div class="edit-link-field">
    @if (Request.IsAuthenticated)
    {
        if (Model.IsOwnedBy(User.Identity.Name))
        {
        @Html.DialogFormLink("Edit Ad", Url.Action("Edit", new { id = Model.AdId }), "EditAd", "Edit Ad", "dialog-ad", Url.Action("Details", new { id = Model.AdId }))
        }
    }
    </div>
</fieldset>
